package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class operationFind implements Ioperation{
    public void work(BookList bookList){
        System.out.print("查找图书：");
        System.out.println("请输入你要查找的书");
        Scanner in = new Scanner(System.in);
        String name = in.nextLine();
        int currentSize = bookList.getUsesize();
        for (int i = 0; i < currentSize; i++) {
            Book book = bookList.getbook(i);
            if(book.getName().equals(name)){
                System.out.println("找到了这本书");
                System.out.println(book.toString());
                return;
            }

        }
        System.out.println("没有你要找的图书");

    }
}
